<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Revert model snapshots API | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'ml-revert-snapshot.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ml-revert-snapshot.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ml-revert-snapshot.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/ml-revert-snapshot.html" rel="nofollow" target="_blank">../en/ml-revert-snapshot.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="rest-apis.html">REST APIs</a></span>
»
<span class="breadcrumb-link"><a href="ml-apis.html">Machine learning anomaly detection APIs</a></span>
»
<span class="breadcrumb-node">Revert model snapshots API</span>
</div>
<div class="navheader">
<span class="prev">
<a href="ml-preview-datafeed.html">« Preview datafeeds API</a>
</span>
<span class="next">
<a href="ml-set-upgrade-mode.html">Set upgrade mode API »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="ml-revert-snapshot"></a>Revert model snapshots API<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/anomaly-detection/apis/revert-snapshot.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>

<p>Reverts to a specific snapshot.</p>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-revert-snapshot-request"></a>Request<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/anomaly-detection/apis/revert-snapshot.asciidoc">edit</a>
</h3>
</div></div></div>
<p><code class="literal">POST _ml/anomaly_detectors/&lt;job_id&gt;/model_snapshots/&lt;snapshot_id&gt;/_revert</code></p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-revert-snapshot-prereqs"></a>Prerequisites<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/anomaly-detection/apis/revert-snapshot.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Before you revert to a saved snapshot, you must close the job.
</li>
<li class="listitem">
If the Elasticsearch security features are enabled, you must have <code class="literal">manage_ml</code> or
<code class="literal">manage</code> cluster privileges to use this API. See
<a class="xref" href="security-privileges.html" title="Security privileges">Security privileges</a>.
</li>
</ul>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-revert-snapshot-desc"></a>Description<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/anomaly-detection/apis/revert-snapshot.asciidoc">edit</a>
</h3>
</div></div></div>
<p>The machine learning features reacts quickly to anomalous input, learning new
behaviors in data. Highly anomalous input increases the variance in the models
whilst the system learns whether this is a new step-change in behavior or a
one-off event. In the case where this anomalous input is known to be a one-off,
then it might be appropriate to reset the model state to a time before this
event. For example, you might consider reverting to a saved snapshot after Black
Friday or a critical system failure.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-revert-snapshot-path-parms"></a>Path parameters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/anomaly-detection/apis/revert-snapshot.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">&lt;job_id&gt;</code>
</span>
</dt>
<dd>
(Required, string)
Identifier for the anomaly detection job.
</dd>
<dt>
<span class="term">
<code class="literal">&lt;snapshot_id&gt;</code>
</span>
</dt>
<dd>
(Required, string)
A numerical character string that uniquely identifies the model snapshot.
</dd>
</dl>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-revert-snapshot-request-body"></a>Request body<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/anomaly-detection/apis/revert-snapshot.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">delete_intervening_results</code>
</span>
</dt>
<dd>
(Optional, boolean) If true, deletes the results in the time period between
the latest results and the time of the reverted snapshot. It also resets the
model to accept records for this time period. The default value is false.
</dd>
</dl>
</div>
<div class="note admon">
<div class="icon"></div>
<div class="admon_content">
<p>If you choose not to delete intervening results when reverting a snapshot,
the job will not accept input data that is older than the current time.
If you want to resend data, then delete the intervening results.</p>
</div>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-revert-snapshot-example"></a>Examples<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/anomaly-detection/apis/revert-snapshot.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">POST _ml/anomaly_detectors/high_sum_total_sales/model_snapshots/1575402237/_revert
{
  "delete_intervening_results": true
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/1835.console"></div>
<p>When the operation is complete, you receive the following results:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "model" : {
    "job_id" : "high_sum_total_sales",
    "min_version" : "6.4.0",
    "timestamp" : 1575402237000,
    "description" : "State persisted due to job close at 2019-12-03T19:43:57+0000",
    "snapshot_id" : "1575402237",
    "snapshot_doc_count" : 1,
    "model_size_stats" : {
      "job_id" : "high_sum_total_sales",
      "result_type" : "model_size_stats",
      "model_bytes" : 1638816,
      "model_bytes_exceeded" : 0,
      "model_bytes_memory_limit" : 10485760,
      "total_by_field_count" : 3,
      "total_over_field_count" : 3320,
      "total_partition_field_count" : 2,
      "bucket_allocation_failures_count" : 0,
      "memory_status" : "ok",
      "categorized_doc_count" : 0,
      "total_category_count" : 0,
      "frequent_category_count" : 0,
      "rare_category_count" : 0,
      "dead_category_count" : 0,
      "categorization_status" : "ok",
      "log_time" : 1575402237000,
      "timestamp" : 1576965600000
    },
    "latest_record_time_stamp" : 1576971072000,
    "latest_result_time_stamp" : 1576965600000,
    "retain" : false
  }
}</pre>
</div>
<p>For a description of these properties, see the <a class="xref" href="ml-get-snapshot.html#ml-get-snapshot-results" title="Response body">get model snapshots API</a>.</p>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="ml-preview-datafeed.html">« Preview datafeeds API</a>
</span>
<span class="next">
<a href="ml-set-upgrade-mode.html">Set upgrade mode API »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>